From f7740fe5801dae48932679df2280c158bea5a1c1 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Wed, 27 Oct 2010 09:32:42 -0400 Subject: [PATCH] Remove size_request from GtkTable --- gtk/gtktable.c | 50 ++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 38 insertions(+), 12 deletions(-) diff --git a/gtk/gtktable.c b/gtk/gtktable.c index 80cf51a5a9..47e94e8454 100644 --- a/gtk/gtktable.c +++ b/gtk/gtktable.c @@ -74,8 +74,12 @@ enum static void gtk_table_finalize (GObject *object); -static void gtk_table_size_request (GtkWidget *widget, - GtkRequisition *requisition); +static void gtk_table_get_preferred_width (GtkWidget *widget, + gint *minimum, + gint *natural); +static void gtk_table_get_preferred_height (GtkWidget *widget, + gint *minimum, + gint *natural); static void gtk_table_size_allocate (GtkWidget *widget, GtkAllocation *allocation); static void gtk_table_compute_expand (GtkWidget *widget, @@ -134,7 +138,8 @@ gtk_table_class_init (GtkTableClass *class) gobject_class->get_property = gtk_table_get_property; gobject_class->set_property = gtk_table_set_property; - widget_class->size_request = gtk_table_size_request; + widget_class->get_preferred_width = gtk_table_get_preferred_width; + widget_class->get_preferred_height = gtk_table_get_preferred_height; widget_class->size_allocate = gtk_table_size_allocate; widget_class->compute_expand = gtk_table_compute_expand; @@ -969,31 +974,52 @@ gtk_table_finalize (GObject *object) } static void -gtk_table_size_request (GtkWidget *widget, - GtkRequisition *requisition) +gtk_table_get_preferred_width (GtkWidget *widget, + gint *minimum, + gint *natural) { GtkTable *table = GTK_TABLE (widget); GtkTablePrivate *priv = table->priv; gint row, col; - requisition->width = 0; - requisition->height = 0; - gtk_table_size_request_init (table); gtk_table_size_request_pass1 (table); gtk_table_size_request_pass2 (table); gtk_table_size_request_pass3 (table); gtk_table_size_request_pass2 (table); + *minimum = 0; + for (col = 0; col < priv->ncols; col++) - requisition->width += priv->cols[col].requisition; + *minimum += priv->cols[col].requisition; for (col = 0; col + 1 < priv->ncols; col++) - requisition->width += priv->cols[col].spacing; + *minimum += priv->cols[col].spacing; + *natural = *minimum; +} + +static void +gtk_table_get_preferred_height (GtkWidget *widget, + gint *minimum, + gint *natural) +{ + GtkTable *table = GTK_TABLE (widget); + GtkTablePrivate *priv = table->priv; + gint row, col; + + gtk_table_size_request_init (table); + gtk_table_size_request_pass1 (table); + gtk_table_size_request_pass2 (table); + gtk_table_size_request_pass3 (table); + gtk_table_size_request_pass2 (table); + + *minimum = 0; for (row = 0; row < priv->nrows; row++) - requisition->height += priv->rows[row].requisition; + *minimum += priv->rows[row].requisition; for (row = 0; row + 1 < priv->nrows; row++) - requisition->height += priv->rows[row].spacing; + *minimum += priv->rows[row].spacing; + + *natural = *minimum; } static void -- 2.30.2